package com.yousu.dashijixm.controller;

import com.yousu.dashijixm.pojo.Result;
import com.yousu.dashijixm.utils.Sample;
import org.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

@RestController
@RequestMapping("/baiduAi")
public class DoBaiDuChat {

    @Autowired
    private Sample sample;


    @GetMapping()
    public Result getAI(String text) throws JSONException, IOException {

        String s = sample.diaoChat(text);
        System.out.println(s);
        return Result.success(s) ;
//        return Result.error("你的权限不支持使用");

    }
}
